/* 2019/5/23 0:53. by soft */

function parseData(res) {
  return {
    code: 0,
    msg: res.message,
    count: (res.payload ? res.payload.total : 0),
    data: (res.payload ? res.payload.records : 0)
  }
}

function sex(s) {
  if (s == 1 || s.sex == 1) {
    return '<span class="layui-badge layui-bg-cyan">男</span>'
  } else {
    return '<span class="layui-badge" style="background-color: hotpink;">女</span>'
  }
}

function maintainerStatus(s) {
  if (s == '在岗' || s.status == '在岗') {
    return '<span class="layui-badge layui-bg-blue">在岗</span>'
  } else {
    return '<span class="layui-badge">离职</span>'
  }
}

// 报修的维修状态
function repairStatus(s) {
  var status = s.status || s;
  if (status == '已取消') {
    return '<span class="layui-badge layui-bg-red">已取消</span>'
  } else if (status == '等待中') {
    return '<span class="layui-badge layui-bg-gray">等待中</span>'
  } else if (status == '维修中') {
    return '<span class="layui-badge layui-bg-orange">维修中</span>'
  } else if (status == '待评价') {
    return '<span class="layui-badge layui-bg-blue">待评价</span>'
  } else if (status == '已完成') {
    return '<span class="layui-badge layui-bg-green">已完成</span>'
  }
}

function isEmpty(s) {
  return s == null || s.trim().length <= 0;
}